package com.hllxd.hism.star.basic.service.service;

import com.hllxd.hism.star.basic.service.dao.mapper.doris.FengkongMapper;
import com.hllxd.hism.star.basic.service.dao.mapper.doris3.FlyleafMapper;
import com.hllxd.hism.star.basic.service.model.doris.FkDapanEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author xiyong.lxy
 * @date 2022-11-27 16:51
 */
@Slf4j
@Service("fengkongService")
public class FengkongServiceImpl implements FengkongService {

    @Autowired
    private FengkongMapper fengkongMapper;

    @Autowired
    private FlyleafMapper flyleafMapper;

    @Override
    public Map<String,FkDapanEntity> loadDashboard(String dt) {
        log.info("params: {}.", dt);
        List<FkDapanEntity> result = fengkongMapper.loadDashboard(dt);
        // 针对content进行格式化
//        result.add(FkDapanEntity.build("2022-11-19","all^uv","7694657.4286","-0.0076"));
        return FkDapanEntity.buildList(result);
    }

    @Override
    public Map<String, FkDapanEntity> readFengkongV2(String dt) {

        log.info("params: {}.", dt);
        List<FkDapanEntity> result = flyleafMapper.readFengkongV2(dt);
        // 针对content进行格式化
//        result.add(FkDapanEntity.build("2022-11-19","all^uv","7694657.4286","-0.0076"));
        return FkDapanEntity.buildList2(result);
    }
}
